package org.osflash.signals.natives;

import asunit.asserts.*;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.MouseEvent;

class NativeRelaySignalTest extends INativeDispatcherTestBase {

	@:meta(Before())
	public function setUp() : Void {
		sprite = new Sprite();
		clicked = new NativeRelaySignal(sprite, "click", MouseEvent);
		signal = new NativeRelaySignal(new EventDispatcher(), "test", Event);
	}

	@:meta(After())
	public function tearDown() : Void {
		clicked.removeAll();
		clicked = null;
	}

	@:meta(Test())
	public function setting_eventClass_to_null_defaults_it_to_Event() : Void {
		cast((clicked), NativeRelaySignal).eventClass = null;
		clicked.dispatch(new Event("click"));
		assertSame(Event, clicked.eventClass);
	}

}

